//go:build wireinject

package main

import (
	"github.com/google/wire"
	"webook/interactive/events"
	"webook/interactive/grpc"
	"webook/interactive/ioc"
	repository2 "webook/interactive/repository"
	cache2 "webook/interactive/repository/cache"
	dao2 "webook/interactive/repository/dao"
	service2 "webook/interactive/service"
)

var thirdPartySet = wire.NewSet(
	//第三方依赖
	ioc.InitRedis,
	//以下是双写需要的数据库
	//ioc.InitSrcDB,
	//ioc.InitDstDB,
	//ioc.InitDoubleWritePool,
	//ioc.InitBizDB,
	ioc.InitDB,
	ioc.InitLogger, ioc.InitSaramaClient, ioc.InitSaramaSyncProducer)
var interactiveSvcSet = wire.NewSet(dao2.NewGORMInteractiveDao, cache2.NewRedisInteractiveCache,
	repository2.NewCachedInteractiveRepository, service2.NewInteractiveService)

func InitApp() *App {
	wire.Build(thirdPartySet, interactiveSvcSet,
		grpc.NewInteractiveServiceServer,
		events.NewInteractiveReadEventConsumer,
		//ioc.InitInteractiveProducer,
		//ioc.InitFixerConsumer,
		ioc.InitConsumers,
		ioc.NewGrpcxServer,
		//ioc.InitGinxServer,
		wire.Struct(new(App), "*"))
	return new(App)
}
